//
//  RTViewController.m
//  WeiLiToy
//
//  Created by baxiang on 01/17/2018.
//  Copyright (c) 2018 baxiang. All rights reserved.
//

#import "RBLaunchController.h"

#import "RBLoginController.h"
#import "RBRegisterController.h"
@interface RBLaunchController ()

@end

@implementation RBLaunchController

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.view.backgroundColor = RTColorForBackground;
    [self setupSubView];
	// Do any additional setup after loading the view, typically from a nib.
}

-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self.navigationController.navigationBar setHidden:YES];
}
-(void)setupSubView
{
    UIImageView *iconImageView = [UIImageView new];
    [self.view addSubview:iconImageView];
    iconImageView.image = [UIImage imageNamed:@"icon_logo"];
    [iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.view.mas_centerX);
        make.width.mas_equalTo(iconImageView.image.size.width);
        make.height.mas_equalTo(iconImageView.image.size.height);
        make.top.mas_equalTo(150);
    }];
    
    UIButton*regiBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [regiBtn setTitle:@"快速注册" forState:UIControlStateNormal];
    regiBtn.titleLabel.font = [UIFont systemFontOfSize:17];
    [self.view addSubview:regiBtn];
    regiBtn.layer.cornerRadius = 45*0.5f;
    regiBtn.backgroundColor = [UIColor whiteColor];
    [regiBtn setTitleColor:RTColorForBackground forState:UIControlStateNormal];
    [regiBtn addTarget:self action:@selector(registerActive) forControlEvents:UIControlEventTouchUpInside];
    [regiBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(45);
        make.left.mas_equalTo(45);
        make.right.mas_equalTo(-45);
        make.bottom.mas_equalTo(-75);
    }];
    
    UIButton*loginBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    loginBtn.layer.cornerRadius = 45*0.5f;
    loginBtn.backgroundColor = [UIColor whiteColor];
    [loginBtn setTitleColor:RTColorForBackground forState:UIControlStateNormal];
    [loginBtn setTitle:@"登录" forState:UIControlStateNormal];
    loginBtn.titleLabel.font = [UIFont systemFontOfSize:17];
    [self.view addSubview:loginBtn];
    [loginBtn addTarget:self action:@selector(loginActive) forControlEvents:UIControlEventTouchUpInside];
    [loginBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(45);
        make.left.mas_equalTo(45);
        make.right.mas_equalTo(-45);
        make.bottom.mas_equalTo(regiBtn.mas_top).offset(-20);
    }];
    
  
}

-(void)loginActive{
    RBLoginController*loginVC = [[RBLoginController alloc] init];
    [self.navigationController pushViewController:loginVC animated:YES];
}

- (void)registerActive{
    RBRegisterController *vc = [[RBRegisterController alloc] init];
    [self.navigationController pushViewController:vc animated:YES];
}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
